//
//  CCAListCellViewModel.m
//  Activity
//
//  Created by its on 15/5/14.
//  Copyright (c) 2015年 coco. All rights reserved.
//

#import "CCAListCellViewModel.h"
#import "CCAcitivityModel.h"
#import "CCDevice.h"
@implementation CCAListCellViewModel

- (id) initWithData:(CCAcitivity *)data {
  if ( self = [super init] ) {
    _headURL = [NSURL URLWithString:data.headImage];
    _name = [[NSAttributedString alloc] initWithString:data.author attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],
                                                                                NSFontAttributeName:[UIFont systemFontOfSize:12]
                                                                                          }];
    _bgURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@?/imageView2/1/w/%lf/h/%lf",data.coverImage[0],DEVICEWIDTH, DEVICEWIDTH*0.8]];
    _title = [[NSAttributedString alloc] initWithString:data.title attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],
                                                                                NSFontAttributeName:[UIFont systemFontOfSize:14]
                                                                                }];
    _people = [[NSAttributedString alloc] initWithString:data.people
                                              attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],
                                                           NSFontAttributeName:[UIFont systemFontOfSize:12]
                                                           }];
    _peopleImage = [UIImage imageNamed:@"a_people"];
    _money = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:
                                                         @"%@",data.money]
                                             attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],
                                                          NSFontAttributeName:[UIFont systemFontOfSize:12]
                                                          }];
    _moneyImage = [UIImage imageNamed:@"a_money"];
    _address = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:
                                                           @"%@",data.address]
                                               attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],
                                                          NSFontAttributeName:[UIFont systemFontOfSize:12]
                                                            }];
    _addressImage = [UIImage imageNamed:@"a_address"];
    _time = [[NSAttributedString alloc] initWithString: data.time
                                            attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],
                                                          NSFontAttributeName:[UIFont systemFontOfSize:12]
                                                         }];
    _timeImage = [UIImage imageNamed:@"a_door"];

  }
  return  self;
}

- (void) dealloc {
  NSLog(@"list cell view model dealloc");
}
@end
